#include<iostream>
#include<exception>





class Myexception:public std::exception
{  
public:
    const char *what()const noexcept// 当前函数不会抛出异常
    {
        return"我自己的异常!";
    }

};





void func()
{
//    throw std::logic_error("luoji"); 
        throw Myexception();
}

void handle()
{
    try
    {
        func();
    }
    catch(const std::exception& e)
    {
        //显示错误信息
        std::cerr << e.what() << '\n';
    }
    
}

int main()
{
    handle();
    return 0;
}
